package simplefactory;

public class Client {
    public static void main(String args[]) {
        try {
            TV tv;
            String brandName = XMLUtilTV.getBrandName();
            if (brandName == null) {
                System.err.println("无法读取配置文件，使用默认品牌");
                brandName = "Haier";  // 默认值
            }
            tv = TVFactory.produceTV(brandName);
            tv.play();
        } catch (Exception e) {
            System.out.println("电视机生产失败：" + e.getMessage());

        }
    }
}
